home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™ 1987-1994 / MacHack™ '87 / McAsmy (v6.0) / mcasmy.doc next >
Encoding:
Text File  |  1992-06-28  |  60.4 KB  |  1,080 lines  |  [TEXT/TEXT]

  1.  
  2.  
  3. **************************************************************************
  4.                 McAssembly* V6.0 Shareware DocsJ
  5.                 Copyright ) 1986 By Signature Software
  6. **************************************************************************
  7. (This document is layed out for Monaco 9, with tabs set to eight spaces.)
  8. **************************************************************************
  9.                         INTRODUCTION
  10. **************************************************************************
  11.         This document briefly describes the McAssembly program - an assembler, 
  12. resource compiler, linker, and job controller for the Macintosh. McAssembly is 
  13. a shareware program - if you like it and use it, then please register it by 
  14. sending $40.00 to:
  15.         Signature Software (checks payable to same)
  16.         2151 Brown Ave.
  17.         Bensalem, PA 19020              (215) 639-8764
  18. All registered owners will receive the following:
  19.         % a 94-page manual
  20.         % the latest version of the program
  21.         % Apple's EDIT editor
  22.         % a symbolic debugger called McBug
  23.         % several example working applications source code files
  24.         % all of the standard Apple equate, trap, and .rel files in McAssembly
  25.                 format
  26.         % a utility to convert McAssembly .rel files to MDS .rel files
  27.         % 24-hour, 7-day telephone support
  28.         (Supplied on an 800K HFS diskette unless otherwise requested.)
  29.         I strongly recommend that you register it if you use it, just for the 
  30. additional examples and manual alone. (This document must of necessity be very 
  31. brief - the manual goes into much greater detail. The MacWrite manual files are 
  32. over 200K, which I thought was too much to expect people to download, so I've 
  33. condensed them into this text file.)
  34.         To those of you who might object that this isn't a complete package 
  35. because I've not distributed everything that you should have (particularly the 
  36. system equate files and examples), I answer as follows:
  37.         % The whole package takes up almost 800K of disk space - I can't 
  38. imagine anyone seriously wanting to download that! The $40.00 registration fee 
  39. is probably a wash when you consider the download charges, the time to downlaod 
  40. and print the docs, and the aggravation. The documentation presented here, 
  41. while condensed, does represent all of the essential information that you need 
  42. to know to use the program, it's just a lot easier if you have the whole 
  43. package. In adition, don't forget that the whole package is a complete assembly 
  44. language development system. Something as complex as that hardly lends itself 
  45. to electronic distribution. In fact, I think I've done a masterful job just in 
  46. getting all of the information you need to use it in only this 50K file.
  47.         % Parts of the package are copyright by Apple Computer, and I can't 
  48. distribute them indiscriminately. I can supply them to registerees under the 
  49. terms of my license with Apple.
  50.         % If you're an experienced Mac assembly language programmer, then the 
  51. information presented here is probably more than enough to get you going. If 
  52. you're converting from some other assembler to McAssembly, you may not even 
  53. need the whole package (although I would still expect you to register.) If 
  54. you're an inexperienced Mac programmer, then the examples in the registered 
  55. package, the system files, and my telephone support would probably be of value 
  56. to you, but I don't see how anyone could object to paying for those.
  57.         % Given the current registration ratios of other Macintosh shareware 
  58. programs, what's wrong with having a little incentive to register?
  59.                                 ____________________________________
  60.                                 |                                  |
  61.                                 |  Dave McWherter       10/29/86   |
  62.                                 |                                  |
  63.                                 |  Compuserve 70057,1612           |
  64.                                 |  Delphi     DMcWherter           |
  65.                                 |__________________________________|
  66. **************************************************************************
  67.                         THE MENU SELECTIONS
  68. **************************************************************************
  69.         First, a description of the menu options:
  70.         File menu:
  71.                 Assemble        assembles a file
  72.                 Link            links a group of files
  73.                 Run job         executes a .job file
  74.                 Save options    save current McAssembly options
  75.                 Quit            what else?
  76.         Assembler menu:
  77.                 Object file             creates a .rel object file
  78.                 Listing to printer      echos output to printer
  79.                 Listing to screen       echos output to screen
  80.                 Listing to file         echos output to .lst file
  81.                 Errors only listing     only outputs error lines
  82.                 Symbol table            outputs symbol table at end
  83.                 Cross reference         outputs cross reference table at end
  84.                 Terse cref mode         removes unref'ed .PSM symbols from      
  85.                                         cross reference list
  86.                 .PSM file               creates a .PSM file
  87.                 DEF all symbols         DEFs all non-.PSM symbols in the file
  88.                 No listing headers      suppresses headers in listings
  89.                 MPW object format       object file will be in MPW format, .o
  90.         Linker menu:
  91.                 Symbol table            outputs symbol table at end
  92.                 .MAP file output        echos output to .map file
  93.                 Printer output          echos output to printer
  94.                 McBug .SYM file         creates symbol file for use with McBug
  95.         Jobs menu:
  96.                 Stop if Asm error       stop the job if assembly error occurs
  97.                 No link if Asm error    don't link if assembly error occurs
  98.                 Force assemblies        force all files in job to be assembled
  99.         Misc. menu:
  100.                 Enable Beep             enable beep at end of commands
  101.                 Use .Print driver       route printer output through the driver
  102.                                         (else goes directly to serial port B)
  103.         Transfer menu:
  104.                 EDIT                    to EDIT program
  105.                 QUED                    to QUED program
  106.                 MDS Convert             to MDS Convert program
  107.                 Other                   to any other program
  108. **************************************************************************
  109.                         SOURCE LINE FORMAT
  110. **************************************************************************
  111.         All source code lines must be in the following form:
  112.         [label] opcode  [operand]       [;] [comment]
  113.         Tabs or spaces separate fields, and >>> only one tab (or space) can 
  114. appear between the opcode field and the operand field <<<. Labels may contain 
  115. up to 100 characters, all of which are significant. Labels may contain 
  116. alphanumeric characters and any of the following characters: _, %, !, @, #, $, 
  117. ?, or period. Labels may be suffixed with a colon if desired.
  118.         The semicolon comment designator character is optional in the majority 
  119. of cases. Specifically, if an opcode appears in the line then you can omit the 
  120. semicolon. If a line contains just a label and a comment, then you have to use 
  121. the semicolon.
  122. **************************************************************************
  123.                         ARITHMETIC EXPRESSIONS
  124. **************************************************************************
  125.         All arithmetic and logical operations are 32-bit operations. McAssembly 
  126. supports the following operators and special characters.
  127.         +       integer addition
  128.         -       integer subtraction
  129.         /       integer division (32 bits/32 bits = 32 bits)
  130.         *       integer multiplication (32 bits * 32 bits = 32 bits)
  131.         MOD     integer modulus
  132.         SHL     logical shift left (16 SHL 2 = 64)
  133.         SHR     logical shift right (16 SHR 3 = 2)
  134.         AND     logical bit AND
  135.         OR      logical bit OR
  136.         XOR     logical bit eXclusive-OR
  137.         NOT     logical bit inverse
  138.         'xxxx'  character constant (1-4 characters, right justified)
  139.         *       current value of program counter
  140.         $       specifies a hexadecimal number
  141.         %       specifies a binary number
  142.                 (The following relational operators return true or false;
  143.                  true = $FFFFFFFF and false = 0.)
  144.         <=      less than or equal
  145.         <>      not equal
  146.         >=      greater than or equal
  147.         <       less than
  148.         >       greater than
  149.         =       equal to
  150.         The expression processor uses standard algebraic precedence rules. Use 
  151. parentheses to force precedence.
  152. **************************************************************************
  153.                         ALIGNMENT
  154. **************************************************************************
  155.         McAssembly automatically aligns those things that must be on an even 
  156. address (opcodes, variable or constant words and longs, trap words, etc.) by 
  157. putting a zero byte in front of them if necessary. However, labels on 
  158. automatically aligned lines still carry the value of the address before the 
  159. alignment. These may be odd. If this happens, McAssembly warns you with a LABEL 
  160. ON ODD ADDRESS message. If that's what you really wanted, then you can ignore 
  161. the warning. Otherwise, you must change the code accordingly, probably by 
  162. adding an explicit ALIGN pseudo-op, and reassemble.
  163. **************************************************************************
  164.                         THE ASSEMBLER PSEUDO-OPS
  165. **************************************************************************
  166.         (These are almost in alpabetical order. In some cases, pseudo-ops which 
  167. are used together are grouped together for description purposes.)
  168. A5OFF   <absolute expr>                 specify initial A5 offset
  169. A5SEC                                   define A5 offset variables
  170. A5END                                   end an A5SEC
  171. A5REF   <symbol> [, <symbol>, ...]      reference an A5SEC variable
  172. All global data which is to be stored offset from A5 must be defined between 
  173. A5SEC and A5END. You can have as many A5SEC's in a file as you want - the 
  174. linker concatenates them. A5OFF may be used to specify the initial offset below 
  175. A5 for all of your globals, and defaults to $100. A5REF is used to reference A5 
  176. variables which are defined in other modules. Symbols which are defined as A5 
  177. variables don't have to have the '(A5)' suffixed to them. For example:
  178.                 a5off   grafSize
  179.                 a5sec
  180.         global1 ds.l    1
  181.         global2 ds.w    2
  182.                 a5end
  183.                 a5ref   external
  184.                 move    global1,d0      this is the same as...
  185.                 move    global1(a5),d0          this
  186.                 move    external,d0     and this is the same as...
  187.                 move    external(a5),d0         this
  188. ALIGN   aligns the PC to an even boundary
  189. BASE    An, <symbol> [,<symbol>, ...]   auto-offsets symbols by An
  190. BASE specifies that a symbol is to be offset by the specified address register 
  191. every time you use it For example, if you do this:
  192.                 base    a6,sym1,sym2
  193.                 move    sym1,d0                 then this instruction
  194.                 move    sym1(a6),d0             is the same as this one and
  195.                 move    sym1(a3),d0             you can override it if you want
  196. CASE    turns on case sensitivity
  197. If you don't use CASE, then case in labels is not significant.
  198. DB      <expr> [, <expr>, ...]  define constant bytes at the PC
  199. DC      <expr> [, <expr>, ...]  define constant words at the PC
  200. DC.B    <expr> [, <expr>, ...]  define constant bytes at the PC
  201. DC.L    <expr> [, <expr>, ...]  define constant longs at the PC
  202. DC.W    <expr> [, <expr>, ...]  define constant words at the PC
  203. DL      <expr> [, <expr>, ...]  define constant longs at the PC
  204. DW      <expr> [, <expr>, ...]  define constant words at the PC
  205. DCB     <count>, <value>        define block of <count> bytes of <value>
  206. DCB.B   <count>, <value>        define block of <count> bytes of <value>
  207. DCB.L   <count>, <value>        define block of <count> longs of <value>
  208. DCB.W   <count>, <value>        define block of <count> words of <value>
  209. FILL    <count>, <value>        equivalent to DCB
  210. DEF     <symbol> [, <symbol>, ...]      externally define symbols
  211. XDEF    <symbol> [, <symbol>, ...]      externally define symbols
  212. DEF and XDEF are equivalent - they allow symbols in this file to be referenced 
  213. from another file.
  214. DSEC    <absolute expr>         start dummy section, org'ed at <absolute expr>
  215. DEND                            end a DSEC
  216. RSEC    [An]                    begin reverse DSEC, org'ed at 0, and BASE       
  217.                                 symbols inside to An (default A6)
  218. ENDR    [<symbol>]              end an RSEC, symbol set to size of the section
  219. DSEC and DEND delimit "dummy sections", which may contain only storage 
  220. allocation statements. No storage is actually allocated for items in a dummy 
  221. section - their primary use is to assign values to record structures. Only 
  222. storage allocation statements are allowed in dummy sections. For example:
  223.                 dsec    1
  224.         sym1    ds.b    1       will have a value of 1
  225.         sym2    ds.w    1       will have a value of 2
  226.         sym3    ds.l    1       will have a value of 4
  227.                 dend
  228. Dummy sections may also be defined in 'reverse' using RSEC, for example:
  229.                 rsec
  230.         sym1    ds      0       will have a value of  0
  231.         sym2    ds.w    1       will have a value of -2
  232.         sym3    ds.l    1       will have a value of -6
  233.         sym4    ds.w    1       will have a value of -8
  234.                 endr    rsize   rsize will have a value of 8
  235. DS      <count>         define <count> words of storage at PC
  236. DS.B    <count>         define <count> bytes of storage at PC
  237. DS.L    <count>         define <count> longs of storage at PC
  238. DS.W    <count>         define <count> words of storage at PC
  239. BOOLEAN <count>         same as ds.w (These allow more mnemonic DS's...)
  240. BYTE    <count>         same as ds.b    "       "       "       "
  241. CHAR    <count>         same as ds.w    "       "       "       "
  242. HANDLE  <count>         same as ds.l    "       "       "       "
  243. HDL     <count>         same as ds.l    "       "       "       "
  244. INTEGER <count>         same as ds.w    "       "       "       "
  245. LONG    <count>         same as ds.l    "       "       "       "
  246. LONGINT <count>         same as ds.l    "       "       "       "
  247. POINT   <count>         same as ds.l    "       "       "       "
  248. POINTER <count>         same as ds.l    "       "       "       "
  249. PTR     <count>         same as ds.l    "       "       "       "
  250. RECT    <count>         same as ds.b  8*<count>
  251. VAR     <count>         same as ds.l    "       "       "       "
  252. WORD    <count>         same as ds.w    "       "       "       "
  253. IF      <absolute expr>         conditional assembly
  254. ELSE                            used with IF
  255. ENDI                            end an IF clause
  256. IFDEF   <symbol>                true if symbol defined
  257. IFNDEF  <symbol>                true if symbol undefined
  258. IF1                             true if pass 1
  259. IF2                             true if pass 2
  260. Conditional assembly control. For example:
  261.                 if      0       the expr is not true, so
  262.                 <statements>            these statements aren't assembled
  263.                 else                            (else clauses are optional)
  264.                 <statements>            but these statements are
  265.                 endi
  266. END             end of program (optional)
  267. EQU     <expr>          equate symbol to <expr>
  268. EQU.B   <expr>          equate symbol to <expr> (equivalent to equ)
  269. EQU.W   <expr>          equate symbol to <expr> (equivalent to equ)
  270. EQU.L   <expr>          equate symbol to <expr> (equivalent to equ)
  271. FSIGN   <absolute expr>         specify program's Finder file signature
  272. FTYPE   <absolute expr>         specify program's Finder file type
  273. For example, if you're assembling an application, then:
  274.                 ftype   'APPL'
  275.                 fsign   'ursg'
  276. Or, if you're assembling a desk accessory to be installed by the Font/DA Mover:
  277.                 ftype   'DFIL'
  278.                 fsign   'DMOV'
  279. IPATH   "pathname"      specify an HFS path to subsequent include files
  280. INCL    "filename"      include another source file
  281. JTBL    <symbol> [, <symbol>, ...]      specify jump table entries
  282. Any symbol that's referenced from another segment by a Bcc, DBcc, JSR, JMP, 
  283. LEA, or PEA instruction >>> must <<< be specified as a jump table entry.
  284. LINE    [ <char> [ , <count> ] ]        prettyprint a line of chars
  285. Outputs a listing line filled with the specified number of characters. <count> 
  286. defaults to 50, and <char> defaults to '*'.
  287. LIST    <absolute expr>         listing control
  288. If the expression is true (not 0), then subsequent source lines appear in the 
  289. listing, otherwise they won't.
  290. LFRAME  [An]            begin local variable stack frame, and BASE symbols      
  291.                         inside to An (default A6)
  292. ENDL    [<symbol>]      end a LFRAME, symbol is set to size of the frame
  293. LFRAME and ENDL allow local variables which are to be stored on the stack to be 
  294. easily defined. Symbols defined within the frame are automatically BASE'd to 
  295. the specified register so that you don't have to suffix them with '(An)'. For 
  296. example:
  297.                 lframe
  298.         local1  integer         will have an a6 offset of -2
  299.         local2  longint         will have an a6 offset of -6
  300.         local3  rect            will have an a6 offset of -14
  301.                 endl    lsize   will have a value of 14
  302.         Subroutine_Entry
  303.                 link    a6,#-lsize      save stack space for locals
  304.                 move    local1,d0       this instruction is the same as...
  305.                 move    -2(a6),d0               this one
  306.                 ...
  307.                 unlk    a6              clear locals from stack
  308.                 rts                     return
  309. LOC                     start new local scope block
  310. LOCSYM  <expr>          change local label character
  311. NOLOC                   auto-LOC on non-local labels
  312. Local symbols begin with a period and may contain the same cast of characters 
  313. as normal labels. Their scope normally extends from one LOC statement to the 
  314. next LOC statement. This can be changed with the NOLOC statement, which causes 
  315. local symbol scopes to extend from one non-local label to the next non-local 
  316. label. The local symbol prefix character can be changed with the LOCSYM 
  317. statement. For example,
  318.                         loc
  319.                 .hello  nop             this .hello
  320.                         loc
  321.                 .hello  nop             is different than this .hello
  322.                 .hello  nop             but this .hello causes an error
  323. Or, using NOLOC,and LOCSYM (for MDS compatibility):
  324.                         noloc
  325.                         locsym  '@'
  326.                 goodbye nop
  327.                 @hello  nop             this @hello
  328.                 solong  nop
  329.                 @hello  nop             is different than this @hello
  330.                 @hello  nop             but this @hello causes an error
  331. MACRO   [&1,&2,...,&F]          begin a macro definition
  332. MACROX  [&1,&2,...,&F]          ditto, no auto LOC on call
  333. ENDM                            end a macro definition
  334. MEXP    <absolute expr>         macro expansion control
  335. These control macros. For example, given a macro called test defined as:
  336.                 test    macro   &1,&2,&3,&4,&5,&6
  337.                         move    &1,d0
  338.                         lea     &2,a0
  339.                         if      &&3 = "hello"
  340.                         nop
  341.                         endi
  342.                         text    &&4             notice quote enclosure
  343.                 lab%5   nop                     notice expand as value string
  344.                         &6                      parameters may be opcodes
  345.                         endm
  346. And a call to test like this:
  347.                 num     equ     1234
  348.                         test    d2,symbol,hello,mikey,num,_Open
  349. Then it would be expanded to the following:
  350.                         move    d2,d0
  351.                         lea     symbol,a0
  352.                         nop
  353.                         text    "mikey"
  354.                 lab1234 nop
  355.                         _Open
  356. MACROs do an automatic LOC on entry so that local symbols inside the macro have 
  357. their own scope. This prevents local symbols inside the macro from conflicting 
  358. with local symbols outside it. MACROX's do not do the LOC - so that you can 
  359. pass local symbols to a macro if you want. MEXP controls whether or not macro 
  360. expansions appear in the listing: they will appear if the expression is true.
  361. NAME    <symbol>        specifies the module name (one source file is a module)
  362. PAGE    ["title"]       page eject, optionally specifying a page title
  363. PFRAME  [An]            begin parameter stack frame, and BASE symbols inside to 
  364.                                 An (default A6)
  365. ENDP    [<symbol>]      end a PFRAME, symbol is set to size of the frame
  366. PFRAME and ENDP allow parameters passed on the stack to subroutines to be 
  367. easily defined. For example, suppose you have a subroutine whose Pascal 
  368. definition is:
  369.    FUNCTION  Slush (parm1: LONGINT; parm2: INTEGER; parm3: BOOLEAN) : INTEGER;
  370. Then you could code it in McAssembly as follows:
  371.                         pframe
  372.                 result  integer         will have an a6 offset of 16
  373.                 parm1   longint         will have an a6 offset of 12
  374.                 parm2   integer         will have an a6 offset of 10
  375.                 parm3   boolean         will have an a6 offset of 8
  376.                         endp    psize   will have a value of 10
  377.                 Slush   link    a6,#0
  378.                         move    parm2,d0        then this is equivalent to
  379.                         move    10(a6),d0               to this
  380.                         ...
  381.                         move    d0,result       returns the result
  382.                         unlk    a6
  383.                         move.l  (sp)+,a0        get return address
  384.                         addi.l  #psize-2,sp     clear parameters (leave result)
  385.                         jmp     (a0)            and return
  386. Notice that PFRAME automatically allocates space for a stacked return address 
  387. and a stacked linkage register, so you have to do a 'link' instruction on entry 
  388. to the routine if you use PFRAME. The ENDP is optional is you have an LFRAME 
  389. immediately following.
  390. PRMT    "prompt"                display a prompt on the screen
  391. PRTR    "string"                send ctrl string to printer
  392. PSIZE   <absolute expr>         set listing page size
  393. REF     <symbol> [, <symbol>, ...]      reference external symbols
  394. XREF    <symbol> [, <symbol>, ...]      reference external symbols
  395. REF and XREF are equivalent and allow you to reference symbols which are 
  396. defined in other modules.
  397. REQU    Dn | An | <register symbol>     equate symbol to a register
  398. For example:
  399.                 dataptr requ    a4
  400.                         move.l  (dataptr),d0    then this is the same as...
  401.                         move.l  (a4),d0                 this
  402.                 bufptr  equ     dataptr
  403.                         move.l  bufptr,d1       and this...
  404.                         move.l  a4,d1                   is the same as this
  405. RPATH   "pathname"      specify an HFS path for the .rel object file
  406. SET     <expr>          set symbol to value, may be reSET again
  407. STRING  <expr>          set DC.B string formats:
  408.                                 0 = no length byte prefixes (default)
  409.                                 else prefix with length bytes
  410. TABS    <n>             specify listing tab stops every <n> columns
  411. TCOMP                   activate the trap compiler (described later)
  412. TERSE                   set short listing format (no line numbers, 16 bits of   
  413.                         program counter)
  414. TEXP    <absolute expr>         text expansion control
  415. If the expression is 0, then only one line of object bytes appears in the 
  416. listing for a TEXT statement. Otherwise all of the bytes generated by the text 
  417. will appear in the listing.
  418. TEXT    [ - | + | # ] "string"          define a text string
  419. '-' sets bit 7 on the last byte of the string. '+' sets bit 7 in every string 
  420. byte (Apple ][ forever!). '#' stuffs a length byte in front of the string. 
  421. (Only one prefix is allowed at a time.) You can use the following escape 
  422. characters in the string:
  423.                 /R      carriage return         $0D
  424.                 /L      linefeed                $0A
  425.                 /"      double quote            $22
  426.                 /T      tab                     $09
  427.                 /E      escape                  $1B
  428.                 /0      null                    $00
  429.                 //      slash                   $2F
  430.                 /F      formfeed                $0C
  431.                 /B      backspace               $08
  432.                 /$hh    any hex number          $hh
  433. For example:
  434.                 text    #"ABC"          generates 05 41 42 43
  435.                 text    +"ABC"          generates C1 C2 C3
  436.                 text    -"ABC"          generates 41 42 C3
  437.                 text    "ABC/T/$21/R"   generates 41 42 43 09 21 0D
  438. TITLE   "string [$] "   specify listing page title, '$' generates a timestamp
  439. TRAPW   <absolute expr> define a trap word
  440. For example:
  441.         _Open   trapw   $A003
  442.                 _Open
  443. **************************************************************************
  444.                         .PSM FILES
  445. **************************************************************************
  446.         Packed symbol files are binary files containing only symbol 
  447. definitions. They're smaller in size than their text equivalents. This saves 
  448. disk space and speeds up assembly. They also speed up assembly because they're  
  449. read only on the first pass of the assembly. They're not read on the second 
  450. pass. Packed symbol files have a filename suffix of .PSM.
  451.         You can create a file of symbol definitions from any source file. Just 
  452. select the assembler .PSM file option and assemble the file. McAssembly dumps 
  453. all the names of all symbols defined in the file and their values to a .PSM 
  454. file at the end of the assembly.
  455.         You use .PSM files by INCLuding them in your source files.
  456.         Symbols that are defined in more than one INCLuded .PSM file are not 
  457. flagged as multiply defined symbols. The symbol takes the value of the last 
  458. definition of it processed by McAssembly. This allows you to use .PSM files 
  459. containing overlapping symbol definitions without worrying about multiple 
  460. definitions.
  461. **************************************************************************
  462.                         THE TRAP COMPILER
  463. **************************************************************************
  464.         McAssembly contains a built-in Trap Compiler which allows certain 
  465. toolbox and O/S traps to be invoked with one line of source code. It eliminates 
  466. much of the drudgery from trap setup and interfacing. For brevity, we'll call 
  467. the Trap Compiler simply the TC throughout the rest of this section.
  468.         The TC was designed to simplify interfacing to the Macintosh 
  469. stack-based traps. Stack-based traps are those traps which pass parameters and 
  470. return results on the 68000 stack. (As opposed to register-based traps, which 
  471. pass parameters and return results in 68000 registers.) Interfacing to 
  472. stack-based traps requires a standard sequence of steps which are common to all 
  473. such traps: 
  474.         1.) If the trap is a function, make room on the stack for the function  
  475.         result.
  476.         2.) Push the parameters on the stack.
  477.         3.) Execute the trap.
  478.         4.) If the trap is a function, remove the function result from the      
  479.         stack.
  480. This standard sequence requires a large amount of source code overhead each 
  481. time a trap is called. Not only is this process tedious to code, but it is also 
  482. prone to errors. The purpose of the TC is two-fold: to eliminate the coding 
  483. overhead and to automate the sequence as much as possible in order to eliminate 
  484. coding errors.
  485.         The TC is not available for use unless you specifically invoke it by 
  486. using the TCOMP pseudo-op. If you want to use the TC, just specify TCOMP at the 
  487. beginning of your source file. TCOMP loads the symbol table with special highly 
  488. encoded macrox definitions of all the stack-based traps.
  489.         Once you've activated the TC with TCOMP, you can then invoke any 
  490. stack-based trap by specifying the name of the trap as an opcode and follow it 
  491. with a list of parameters as operands like this:
  492.         TrapName <tab> param1, param2,...,paramn [,=result]
  493. Notice that TrapName is not preceded by an underscore character. This allows 
  494. you to bypass the TC and manually invoke all of the traps by using the trap 
  495. name preceded by an underscore.
  496.         The list of parameters param1...paramn varies depending on the trap 
  497. you're calling. The parameters in the list correspond exactly to the PASCAL 
  498. definitions of the traps in Inside Macintosh. Some traps don't have any 
  499. parameters, in which case you don't specify any. The contents of the parameters 
  500. you specify are automatically pushed onto the stack for you by the TC. The size 
  501. of the item pushed (byte, word, long) is also automatically taken care of for 
  502. you by the TC.
  503.         In some cases, you'll want to use the address of a symbol as a 
  504. parameter instead of its contents. The TC allows you to do that by specifying 
  505. an exclamation point character ! in front of the parameter. Note that ! is only 
  506. allowed on parameters of size long.
  507.         The =result item is only used on functions. If the trap returns a 
  508. result on the stack, then it's a function and you have to specify where you 
  509. want the result to be stored. In the case of functions, the TC automatically 
  510. creates room on the stack for the function result before stacking any input 
  511. parameters and pops the result off the stack after the trap returns and stores 
  512. it in the result parameter you specify (again, taking care of sizing 
  513. automatically.) The = before a result item is optional. It's only purpose is to 
  514. improve readability of your code.
  515.         All of this may sound complex, but it's really pretty easy to use. 
  516. Examples are a better way to explain it, so...
  517. AN EXAMPLE
  518.         Here's an example of using the TC. We'll use the Menu Manager trap 
  519. _NewMenu which has a PASCAL definition of:
  520.         function NewMenu (menuID:INTEGER; menuTitle:Str255) : MenuHandle
  521. Here's a code fragment using this trap:
  522.                         tcomp                   turn on the trap compiler
  523.         ourTitle        text    #"Example"      parameters we'll need
  524.         ourMenu equ     100
  525.                         a5sec
  526.         MHandle ds.l    1
  527.                         a5end
  528.                         NewMenu #ourMenu,!ourTitle,=MHandle
  529. This trap call would be expanded by the TC to the following sequence:
  530.                         subq.l  #4,sp
  531.                         move.w  #ourMenu,-(sp)
  532.                         pea     ourTitle,-(sp)
  533.                         dc.w    $A931
  534.                         move.l  (sp)+,MHandle
  535. Notice that in this example we needed the address of the title so we prefixed 
  536. ourTitle with !.
  537.         Let's use the same trap for another example. Assume that this time we 
  538. have computed the value of the menu ID and the address of the title string 
  539. dynamically. Assume further that the menu ID is in register D1 and the title 
  540. string address is in A2. We would then invoke the trap as follows:
  541.                         NewMenu d1,a2,a0
  542. Which would expand to:
  543.                         subq.l  #4,sp
  544.                         move.w  d1,-(sp)
  545.                         move.l  a2,-(sp)
  546.                         dc.w    $A931
  547.                         move.l  (sp)+,a0
  548. Notice that this time we didn't specify the = to indicate a function result. 
  549. This is perfectly acceptable but not as readable. Also notice that we stored 
  550. the result in register A0 as opposed to MHandle.
  551. A NAMING QUIRK
  552.         There are two stack-based traps which have the same names as McAssembly 
  553. opcodes: the QuickDraw traps Move and Line. To avoid conflicts, if you want to 
  554. use the TC on these traps, be aware that they're renamed QDMove and QDLine in 
  555. the TC. You have to use these new names if you want the TC to recognize these 
  556. two traps.
  557. WHAT TRAPS AREN'T RECOGNIZED
  558.         The trap compiler doesn't contain definitions for the following traps 
  559. (because they're register-based):
  560.         Device Manager
  561.         File Manager
  562.         Memory Manager
  563.         OS Event Manager
  564.         OS Utilities
  565.         Segment Loader
  566.         In addition, only the following packages are supported:
  567.         International
  568.         Standard File
  569.         Disk Initialization
  570.         SCSI Manager
  571.         List Manager
  572.         (The trap compiler contains definitions for all of the stack-based Mac+ 
  573. traps for the new 128K ROM.)
  574. USING IT WITH .PSM FILES
  575.         There are naming conflicts between the names recognized by the TC and 
  576. some equates in the .PSM files. In particular, some "routine selector" equates 
  577. will cause conflicts. For example, SFGetFile is both a legal TC trap name and a 
  578. routine selector equate in the PackMacs.PSM file. If you want to use the TC 
  579. with the .PSM files, then you must activate it after you've included the .PSM 
  580. files!. In other words, don't use TCOMP until after all of your includes. If 
  581. you do this, then the symbols which are in both files will be forced to be trap 
  582. compiler names. The duplicated symbols will no longer be available as equated 
  583. values. Which is what you want, since if you're using the TC, then you won't 
  584. need the routine selector equates.
  585. **************************************************************************
  586.                         THE RESOURCE COMPILER
  587. **************************************************************************
  588.         McAssembly contains a built-in Resource Compiler which can assemble 
  589. resource definitions. A two-character resource delimiter at the start of a 
  590. source line identifies resource definitions. The delimiter sequence $$ starts a 
  591. standard resource definition, a definition of a resource type that McAssembly 
  592. knows how to interpret. The delimiter sequence [[ starts a user-defined 
  593. resource definition, a definition of a resource type that McAssembly doesn't 
  594. know how to interpret. The delimiter sequence ]] ends a user defined resource 
  595. definition. Standard resource definitions don't require an ending delimiter 
  596. because McAssembly knows where the resource definition ends from information 
  597. you supply in the definition.
  598.         The formats of the two types of definitions are as follows:
  599.         $$ TYPE, ID, ATTR, NAME [<tab>] [;] [comment]
  600.         <item list>
  601.         or
  602.         [[ TYPE, ID, ATTR, NAME [<tab>] [;] [comment]
  603.         <code and/or data>
  604.         ]]
  605.         TYPE is a four-character resource type. For standard definitions, it 
  606. must be one that McAssembly recognizes. For a user-defined definition, it can 
  607. be any four characters. ID is the resource ID number. ATTR specifies the 
  608. attribute byte for the resource. NAME is the name string of the resource. ATTR 
  609. and NAME are optional parameters and may be omitted, although you can't omit 
  610. the ATTR if you want to specify a NAME. Here are two examples for a standard 
  611. resource, one with all parameters specified, and one with ATTR and NAME 
  612. omitted:
  613.         $$ ALRT, 2, 0, alert no. 2
  614.         $$ WIND, 1
  615.         The item list is simply a list of items that make up the resource 
  616. definition. McAssembly interprets each item in the list in a certain way. The 
  617. types of items you specify in the list must correspond exactly with the types 
  618. of items that McAssembly expects for that resource. If you specify an item of 
  619. the wrong type or if you specify too many or too few items, you'll get syntax 
  620. errors (many) on subsequent lines of the file. 
  621.         Items in the item list appear at the beginning of subsequent source 
  622. lines after the line containing the $$. The format of lines in the item list is 
  623. as follows:
  624.         item [, item, ...] [<tab>] [;] [comment]
  625.         item [, item, ...] [<tab>] [;] [comment]
  626.         etc... for as many lines as it takes to specify all items
  627. As you can see, you have your choice of entering each item on its own source 
  628. line, or of placing several items on one line, or a combination of either. 
  629. McAssembly ignores all subsequent characters on the line after a tab or ; 
  630. character and skips to the start of the next line for the next item in the 
  631. list.
  632.         There are several types of items. The type of each is marked in the 
  633. descriptions of the formats for each standard resource. These types have the 
  634. following meanings:
  635.         bexp    an expression interpreted as a byte
  636.         wexp    an expression interpreted as a word
  637.         lexp    an expression interpreted as a long
  638.         chrl    a four-character long
  639.         str     a string
  640.         bexp, wexp, and lexp items are numeric expressions and can be any legal 
  641. McAssembly expression. In most cases, you don't have to worry about what size 
  642. the expression is. In some cases you do, particularly in the bit maps, which 
  643. McAssembly interprets as a sequence of longwords.
  644.         Enter chrl items as a sequence of from one to four characters. If you 
  645. specify fewer than four characters, then the item is left justified in a 32-bit 
  646. long and padded on the right with spaces. Don't enclose the characters in 
  647. quotation marks.
  648.         You may enter strings in either of two ways. First, if your string 
  649. contains no special characters or leading spaces you can just type the string. 
  650. If it does contain special characters or leading spaces, you must enclose the 
  651. string in quotation marks as "string".  (Any of the escape sequences allowed in 
  652. TEXT strings are allowed in string.) If your string isn't enclosed in quotation 
  653. marks, then you can continue the string to the start of the next line by ending 
  654. the string with a \ character. Strings enclosed in quotes can't be continued to 
  655. the next line. You can specify a null string (a string with a length of zero) 
  656. with the vertical bar |.
  657.         The code and/or data in a user-defined resource may be any combination 
  658. of legal McAssembly instruction opcodes or pseudo-ops. The definition must end 
  659. with the ]] delimiter or you'll get an error message.
  660. STANDARD RESOURCE FORMATS
  661.         What follows is a list of the standard resource types that McAssembly 
  662. recognizes and the formats of the item lists for each. Each item in these 
  663. formats appears on its own source line but that doesn't have to be the case. 
  664. They're only shown that way here for clarity.
  665. ----------------------------------------------------------------------------
  666. $$ ALRT,ID,ATTR,NAME
  667. TOP             wexp    bounds rectangle:
  668. LEFT            wexp
  669. BOTTOM          wexp
  670. RIGHT           wexp
  671. DITL_LIST_ID    wexp    resc ID of item list
  672. STAGES          wexp    see DLOG Mgr, IM, page 35
  673. ----------------------------------------------------------------------------
  674. $$ BNDL,ID,ATTR,NAME
  675. SIGNATURE               chrl    application's signature
  676. VERS_DATA_RESC_ID       wexp    0 by convention
  677. NO_RESC_TYPES           wexp    no. of BNDL resc types that follow:
  678. For each resc type:
  679. RESOURCE_TYPE           chrl    typically ICN# or FREF
  680. NO_MAPPINGS_THIS_TYPE   wexp    no. of mappings that follow:
  681. For each mapping:
  682. LOCAL_ID        wexp
  683. ACTUAL_ID       wexp
  684. ** Note: If you use the standard BNDL resource in a module, then McAssembly
  685. automatically sets the bundle bit in the output file after the link is 
  686. completed.
  687. ----------------------------------------------------------------------------
  688. $$ CNTL,ID,ATTR,NAME
  689. TOP                     wexp    bounds rectangle:
  690. LEFT                    wexp
  691. BOTTOM                  wexp
  692. RIGHT                   wexp
  693. INITIAL_VALUE           wexp    current value of control
  694. VISIBLE                 wexp    boolean
  695. MAX_VALUE               wexp    maximum value of control
  696. MIN_VALUE               wexp    minimum value of control
  697. CTRL_DEFINITION_ID      wexp    resc ID of the definition function for
  698.                                         the control type:
  699.                                                 0  simple button
  700.                                                 1  check box
  701.                                                 2  radio button
  702.                                                 8  add to use window's font
  703.                                                 16 scroll bar
  704. REFCON                  lexp    user defined value
  705. TITLE                   str     the control's title
  706. ----------------------------------------------------------------------------
  707. $$ CURS,ID,ATTR,NAME
  708. CURSOR_DATA_BYTES       lexp    eight longs of cursor image:
  709.    "    lexp
  710.    "    lexp
  711.    "    lexp
  712.    "    lexp
  713.    "    lexp
  714.    "    lexp
  715.    "    lexp
  716. CURSOR_MASK_BYTES       lexp    eight longs of cursor mask:
  717.    "    lexp
  718.    "    lexp
  719.    "    lexp
  720.    "    lexp
  721.    "    lexp
  722.    "    lexp
  723.    "    lexp
  724. H_OF_HOT_SPOT           wexp    horizontal of the hot spot
  725. V_OF_HOT_SPOT           wexp    vertical of the hot spot
  726. ----------------------------------------------------------------------------
  727. $$ DITL,ID,ATTR,NAME
  728. NO_ITEMS_IN_LIST        wexp    no. of items in this list:
  729. For each item in the list:
  730. HANDLE_HOLDER           lexp    placeholder for handle or pointer - normally 0
  731. TOP                     wexp    display rectangle (local coordinates):
  732. LEFT                    wexp
  733. BOTTOM                  wexp
  734. RIGHT                   wexp
  735. ITEM_TYPE               bexp    type of the item:
  736.                                         0   user defined (dialog only)
  737.                                         4   std button control
  738.                                         5   std check box control
  739.                                         6   std radio button control
  740.                                         7   defined in CTRL template
  741.                                         8   static text
  742.                                         16  editable text (dialog only)
  743.                                         32  icon
  744.                                         64  QuickDraw picture
  745.                                         128 add to any of above to disable
  746. ITEM    ----                    the actual item; contents of this field
  747.                                 depend on item type as follows:
  748.                                 If item type is, then content is:
  749.                                  4,5,6  str     control title
  750.                                  7      wexp    resc ID of template
  751.                                  8,16   str     the text
  752.                                  32,64  wexp    resc ID of ICON or PICT
  753.                                  0      nil     empty (length = 0)
  754. ----------------------------------------------------------------------------
  755. $$ DLOG,ID,ATTR,NAME
  756. TOP                     wexp    bounds rectangle:
  757. LEFT                    wexp
  758. BOTTOM                  wexp
  759. RIGHT                   wexp
  760. WINDOW_DEFINITION_ID    wexp    the type of window:
  761.                                         0  std doc wind or modeless dialog box
  762.                                         1  alert box or modal dialog box
  763.                                         2  plain box
  764.                                         3  plain box with shadow
  765.                                         4  doc window without size box
  766.                                         16 rounded corner window
  767. VISIBLE                 wexp    boolean, initial state of dialog
  768. GOAWAY                  wexp    boolean, TRUE means window has a close box
  769. REFCON                  lexp    user defined value
  770. RESC_ID_OF_ITEM_LIST    wexp    resc ID of the DITL for this dialog
  771. TITLE                   str     the dialog's title (0 length string if modal    
  772.                                 dialog box)
  773. ----------------------------------------------------------------------------
  774. $$ FREF,ID,ATTR,NAME
  775. FILETYPE                chrl    typically APPL
  776. LOCAL_ID_FOR_ICON_LIST  wexp
  777. FILENAME                str     filename that should follow the file
  778.                                         to a new disk (null string if none) 
  779. ----------------------------------------------------------------------------
  780. $$ ICON,ID,ATTR,NAME
  781. (32) ICON_BYTE_LONGS    lexp    icon bit map - 32 longs:
  782. ...
  783. ...
  784. ----------------------------------------------------------------------------
  785. $$ ICN#,ID,ATTR,NAME
  786. (32) ICON1_BYTE_LONGS   lexp    icon bit map - 32 longs:
  787. ...
  788. ...
  789. (32) ICON2_BYTE_LONGS   lexp    icon bit map mask - 32 longs:
  790. ...
  791. ...
  792. ----------------------------------------------------------------------------
  793. $$ MENU,ID,ATTR,NAME
  794. WIDTH_HOLDER            wexp    0 - placeholder for menu width
  795. HEIGHT_HOLDER           wexp    0 - placeholder for menu height
  796. STD_MENU_PROC_HOLDER    lexp    normally 0
  797. ENABLE_MASK             lexp    bit 0 set if menu enabled,
  798.                                 bit 1 set if menu item 1 enabled,
  799.                                 bit 2 set if menu item 2 enabled,
  800.                                 etc...
  801. MENU_TITLE              str     the menu's title
  802. NUMBER_MENU_ITEMS       wexp    number of items in the menu:
  803. For each menu item:
  804. MENU_ITEM               str     the text of the item
  805. ICON_NUMBER             bexp    0 = none, ICON'S resc ID = ICON number + 256
  806. KEYBD_EQUIV             bexp    equivalent kybd char code, 0 = none
  807. MARKING_CHAR            bexp    marking char code, 0 = no mark
  808. TEXT_STYLE              bexp    text style of the item:
  809.                                         bit 0 = bold
  810.                                         bit 1 = italic
  811.                                         bit 2 = underline
  812.                                         bit 3 = outline
  813.                                         bit 4 = shadow
  814.                                         bit 5 = condense
  815.                                         bit 6 = extend
  816. ----------------------------------------------------------------------------
  817. $$ PAT ,ID,ATTR,NAME
  818. PATTERN_BYTES   lexp    two longs:
  819.    "            lexp
  820. ----------------------------------------------------------------------------
  821. $$ PAT#,ID,ATTR,NAME
  822. NO_OF_PATTERNS          wexp    the number of patterns in the list:
  823. For each pattern:
  824. PATTERN_BYTES           lexp    two longs:
  825.    "                    lexp
  826. ----------------------------------------------------------------------------
  827. $$ STR ,ID,ATTR,NAME
  828. STRING                  str
  829. ----------------------------------------------------------------------------
  830. $$ STR#,ID,ATTR,NAME
  831. NO_OF_STRINGS           wexp    the number of strings in the list:
  832. For each string:
  833. STRING                  str
  834. ----------------------------------------------------------------------------
  835. $$ WIND,ID,ATTR,NAME
  836. TOP                     wexp    bounds rectangle:
  837. LEFT                    wexp
  838. BOTTOM                  wexp
  839. RIGHT                   wexp
  840. WINDOW_DEFINITION_ID    wexp    window type:
  841.                                         0  std doc window or modeless dialog    
  842.                                         box
  843.                                         1  alert box or modal dialog box
  844.                                         2  plain box
  845.                                         3  plain box with shadow
  846.                                         4  doc window without size box
  847.                                         16 rounded corner window
  848. VISIBLE                 wexp    boolean, initial state of window
  849. GOAWAY                  wexp    boolean, TRUE means window has a close box
  850. REFCON                  lexp    user defined value
  851. TITLE                   str     the window's title
  852. ----------------------------------------------------------------------------
  853. [[ XXXX,ID,ATTR,NAME    user defined resource
  854. <DATA/CODE>             whatever you want
  855. ...
  856. ]]                      don't forget the ender!
  857. ----------------------------------------------------------------------------
  858. **************************************************************************
  859.                         LINKING
  860. **************************************************************************
  861.         McLink is the linker portion of the McAssembly program. McLink links 
  862. together .REL files produced by McAssembly and stores the result in a resource 
  863. file. Depending on the contents of the .REL files, the resulting resource file 
  864. is either a pure resource file or an executable application.
  865.         (McAssembly can't link object files which are in the MDS or MPW 
  866. formats. The reverse is also true. However, McAssembly can generate MPW format 
  867. object files, and a utility is provided to those who register that will convert 
  868. McAssembly object files to MDS object files.)
  869.         The file you specify to McLink is actually a link specification file. 
  870. It contains the names of the files to be linked and the name of the resulting 
  871. output file. The specification file has the following format (each filename is 
  872. on a separate line):
  873.         input .REL filename 1
  874.         input .REL filename 2
  875.         ...
  876.         % input resource filename n
  877.         % input resource filename n+1
  878.         ...
  879.         * lines starting with an asterisk are comments and are ignored
  880.         ...
  881.         * lines starting with an '@' are path specifiers - they specify an HFS
  882.         *       path to use to access all subsequent files
  883.         @ pathname
  884.         ...
  885.         /output filename
  886. The input files must be either McAssembly .REL files or resource files. The % 
  887. character must be the first character of lines containing resource filenames to 
  888. differentiate them from .REL files. If an input filename doesn't end in .REL 
  889. and it's not a resource file, McLink adds .REL to the name before it tries to 
  890. open the file. The output filename must be the last filename in the list and 
  891. must be preceded by a slash character.
  892.         Resource files are handled as follows: McLink copies all resources in 
  893. the resource file to the linked output file. If a resource in the resource file 
  894. is the same as a resource defined in a .REL file, the resource file copy will 
  895. replace the .REL file copy in the output file. If a BNDL resource is copied, 
  896. the output file's bundle bit is set.
  897.         There are only two aspects of ordering that you must follow: 1.) the 
  898. first data item in the first file that's linked must be the starting 
  899. instruction of the program, and 2.) all resources must be linked after all code 
  900. and/or data. If you attempt to link code after a resource has been linked you 
  901. get an error message.
  902. **************************************************************************
  903.                         SEGMENTING
  904. **************************************************************************
  905.         McAssembly lets you divide up your application into segments. To 
  906. implement segmenting, you have to do two things: 1.) specify what routines in a 
  907. particular module may be called from other segments, and 2.) specify the 
  908. partitioning of the code into segments, i.e., what modules are in what 
  909. segments. Item 1 is accomplished through the use of the JTBL pseudo-op and 
  910. allows McLink to construct the jump table containing an entry for every 
  911. cross-segment accessible routine. Item 2 is accomplished by a SEGMENT COMMAND 
  912. LINE in your link specification file and tells McLink how to break up the code 
  913. into segments. The JTBL pseudo-op is described earlier and the segment command 
  914. line description follows.
  915.         The Segment Command Line is a special command line in the link 
  916. specification file. It has the following syntax:
  917.         $ [P] [L]
  918. The $ character tells the linker that this line is not the name of a file to be 
  919. linked but is the start of a new segment. The segment command line writes all 
  920. modules linked so far to the output file as one segment and groups all 
  921. subsequent modules (until another segment command line) into a new segment. The 
  922. P and L parameters specify the attributes of the new code segment. P specifies 
  923. that the segment is to be "preloaded" and L specifies that the segment is to be 
  924. "locked." The default for both of these parameters is "not preloaded" and "not 
  925. locked." (Don't specify a segment command line for the first segment. McLink 
  926. defaults the attributes for segment number one to "preloaded," "locked," and 
  927. "purgeable.")
  928.         Here's an example link specification file for an application that 
  929. contains four code segments:
  930.         MAIN
  931.         $
  932.         SEG2A
  933.         SEG2B
  934.         $ P
  935.         SEG3
  936.         $ L P
  937.         SEG4
  938.         /MAIN.APPL
  939. In this example, MAIN is in segment one, SEG2A and SEG2B in segment two, SEG3 
  940. in segment three, and SEG4 in segment four. All segments are purgeable; 
  941. segments one, three and four are to be preloaded; and segments one and four are 
  942. locked. The resulting application program is placed in the file MAIN.APPL.
  943. **************************************************************************
  944.                         JOB FILES
  945. **************************************************************************
  946.         The File menu Run job choice in McAssembly operates on a Job 
  947. Specification File. A job specification file contains a list of filenames to be 
  948. assembled and linked to form an output file. By using a job specification file, 
  949. you eliminate assembling each file separately and invoking the linker to link 
  950. them.
  951.         The format of a job specification file is a link specification file 
  952. whose filenames have no suffixes (.ASM or .REL). In fact, a job specification 
  953. file can be used as a link specification file, providing it specifies an output 
  954. file in its last filename line. Here's an example of a job specification file:
  955.         * This is a comment line
  956.         * Assemble the file X.ASM if necessary:
  957.         X
  958.         * Assemble the file Y.ASM if necessary:
  959.         Y
  960.         * Assemble the file Z.ASM if necessary:
  961.         Z
  962.         * Put the linked X.REL, Y.REL and Z.REL files into the
  963.         *       output file XYZ:
  964.         /XYZ
  965.         To understand what the job control manager does for this file, 
  966. understand first that a job is run in two phases, an assembly phase and a link 
  967. phase. The assembly phase assembles the files and the link phase links the 
  968. resulting .REL files.
  969.         During the assembly phase, the job control manager ignores any line in 
  970. the specification file which starts with any of the characters *, $, or / or 
  971. which is a blank line. These are comment lines and link control lines which 
  972. have no meaning in assembly. Any other lines are assumed to contain a 
  973. non-suffixed filename which is a candidate for assembly. For example, the first 
  974. thing the job control manager does for this job file is to skip the first two 
  975. lines because they're comment lines. It then operates on the line X. The job 
  976. control manager looks to see if X.ASM is on the disk. Let's assume for the 
  977. purposes of this example that X.ASM isn't on the disk. In this case, the job 
  978. control manager assumes that X.REL exists and that you don't want to reassemble 
  979. it. So the specification file line containing X is ignored.
  980.         The next line is examined similarly. Let's assume the converse here - 
  981. that Y.ASM does exist. The job control manager assembles Y.ASM if either one of 
  982. the following two conditions is met: 1.) there is no Y.REL file on the disk, or 
  983. 2.) the existing copy of Y.REL is out-of-date. (It's out-of-date if the 
  984. modification date of Y.REL is earlier in time than the modification date of 
  985. Y.ASM.) In either of these two cases, Y.ASM is assembled, creating a new copy 
  986. of Y.REL. If Y.REL is up-to-date, then the specification line containing Y is 
  987. skipped and no assembly is performed.
  988.         Having disposed of the Y file line, the job control manager goes on to 
  989. the Z file line. A similar analysis goes on as above and Z.ASM is assembled if 
  990. necessary.
  991.         Finally, the last line, /XYZ, is examined. The job control manager 
  992. recognizes this as an output file specification line for the linker, so the 
  993. linker is invoked. This ends the assembly phase of the job and begins the link 
  994. phase.
  995.         In the link phase, the linker links the files using the job 
  996. specification file as the link specification file. After the link is complete, 
  997. the job is done and control returns to the top level of McAssembly.
  998.         If the /XYZ line doesn't exist in the job file, then the job control 
  999. manager assumes that no link is desired and skips the linker phase of the job. 
  1000. This allows you to use job files for just assemblies.
  1001. **************************************************************************
  1002.                         FILE SUFFIXES
  1003. **************************************************************************
  1004.         McAssembly requires certain suffixes on filenames as follows: (These 
  1005. can be in any combination of upper or lower case.)
  1006.         .asm    assembler source files
  1007.         .rel    assembler object files
  1008.         .psm    packed symbol files
  1009.         .lnk    link specification file
  1010.         .job    job specification file or link specification file
  1011.         .map    linker listing output file
  1012.         .sym    binary symbol table output by the linker for use by McBug
  1013. **************************************************************************
  1014.                         MPW FORMAT
  1015. **************************************************************************
  1016.         McAssembly can create object files in the MPW format. The linker can't 
  1017. link them, but you can link them with the MPW linker. MPW object files will 
  1018. have the suffix '.o.' as opposed to the normal '.rel'.
  1019.         There are two special assembler pseudo-ops in MPW mode. You can use 
  1020. them in normal McAssembly mode, but they'll have no effect on the output files. 
  1021. These pseudo-ops and their descriptions are: 
  1022.         MAIN
  1023.         Identifies a module as being the main code and data module in the 
  1024. application. This causes two things to happen: 1.) The first instruction in the 
  1025. module will be the first instruction executed when the resulting linked 
  1026. application is executed, and 2.) Any A5SEC data in the module is guaranteed to 
  1027. be located immediately below A5. (This data placement is discussed in more 
  1028. detail below.)
  1029.         (In McAssembly, a "module" is equivalent to a source file. This is 
  1030. different than the MPW definition of a module, which allows any number of 
  1031. modules to be contained in one source file.)
  1032.         SEG     ["<segment name>"]
  1033.         Allows you to control the segmentation of your program. Only the last 
  1034. seg statement in a source file is effective. It causes all of the code 
  1035. generated by that file to be placed in a segment named segment name. Code which 
  1036. resides in any particular segment doesn't have to be linked consecutively - the 
  1037. MPW linker figures out what goes where and collects all segment code together 
  1038. regardless of what order the files are linked in. If you don't use a seg 
  1039. statement in a file or use a seg without a segment name then all of the code in 
  1040. the file is placed in a segment named Main by the  linker.
  1041.         (Again, this is slightly different than the MPW convention, which 
  1042. allows code in any one source file to be placed into any number of segments.)
  1043. RESTRICTIONS
  1044.         Just as there are some things you can do in the MPW assembler that you 
  1045. can't do in McAssembly, there are also some McAssembly features that can't be 
  1046. implemented with the MPW object format. Here's what you can't do in MPW mode:
  1047.         1.) The pseudo-ops A5OFF, FSIGN, and FTYPE are illegal in MPW mode.
  1048.         2.) None of the resource compiling capabilities can be used.
  1049.         3.) In McAssembly, you can branch to an externally defined symbol using 
  1050. the Bcc, BSR, and DBcc instructions. You can't do that in MPW. You have to use 
  1051. equivalent JSR and JMP instructions instead.
  1052. A5 DATA STORAGE
  1053.         The MPW linker has a slightly different perspective of A5 data 
  1054. allocation than MDS had - it's entirely under your control. This means that the 
  1055. linker has no provisions for allowing for the usual $100 bytes of QuickDraw 
  1056. global storage on top of your own A5 data. If your programs rely on this (and 
  1057. they do if they do an InitGraf !-4(A5) when they start up!), then you have to 
  1058. allocate this area specifically yourself. You can do it very simply like this
  1059.                 a5sec
  1060.         <your own global variable definitions>
  1061.                 ds.b    grafSize        QuickDraw's space
  1062.                 a5end
  1063. but there are two important restrictions for this to work properly:
  1064.         1.) The grafSize bytes of A5 storage must be defined in the main module 
  1065. (the source file containing the main pseudo-op.) If it's not in the main 
  1066. module, then the linker will not necessarily place it immediately below A5.
  1067.         2.) The grafSize bytes of A5 storage must be the last A5 storage item 
  1068. defined in the main module. In other words, if you have several A5SEC's in your 
  1069. main file, then make sure that the grafSize bytes are the last A5SEC item in 
  1070. the file. (This is because McAssembly allocates A5 variables in reverse order 
  1071. of how they appear in the file - the first A5 variable is the lowest in memory, 
  1072. and the last is highest in memory.)
  1073.         (Notice that grafSize, which is defined in the QuickEqu system file, is 
  1074. only $CE bytes, not $100. GrafSize is all that's actually required. I think the 
  1075. $100 was just used for historical reasons as an arbitrarily large enough 
  1076. number.)
  1077.  
  1078. Download complete.  Turn off Capture File.
  1079.  
  1080. <B>rowse, <R>epeat, or <Q>uit?